home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
prolog_2.zip
/
PUZZLES.ZIP
/
CONSOLE.PRO
< prev
next >
Wrap
Text File
|
1986-07-20
|
640b
|
19 lines
get_answer( A ) :-
ratom( X ), name( X, String ),
valid_resp( String, A ), !.
valid_resp( [H|T], A ) :- type_ans( H, A ).
type_ans( X, A ) :- ([X] = "y"; [X] = "Y"), A = yes.
type_ans( X, A ) :- ([X] = "n"; [X] = "N"), A = no.
type_ans( X, A ) :- ([X] = "w"; [X] = "W"), A = why.
?-print('\nYou can start animal by typing "help.<CR>"\n' ).
valid_resp( [], A ) :-
print('\nPlease try to give me a yes or no answer.'),
get_answer( A ), !.
valid_resp( [H|T], A ) :- valid_resp( T, A ).